// 引入初始化的样式文件
import '@/styles/common.scss'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

import { useIntersectionObserver } from '@vueuse/core'

// 测试函数接口
// import {getCategory} from '@/apis/testAPI.js'
// getCategory().then(res => {
//   console.log(res)
// })
const app = createApp(App)

app.use(createPinia())
app.use(router)

app.mount('#app')
app.directive('img-lazy', {
  mounted(el,binding){
    console.log(el,binding)
    useIntersectionObserver(
      el,
      ([isIntersecting]) => {
        console.log(isIntersecting)
        if (isIntersecting) {
          el.src = isIntersecting
        }
      },
    )
  }
})
